package com.api.shopapi.service.impl;

import com.api.shopapi.entity.GoodsColorRemark;
import com.api.shopapi.mapper.GoodsColorRemarkMapper;
import com.api.shopapi.service.GoodsColorRemarkService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("GoodsColorRemarkServiceImplOne")
public class GoodsColorRemarkServiceImpl implements GoodsColorRemarkService {

    @Autowired
    private GoodsColorRemarkMapper goodsColorRemarkMapper;

    @Override
    public int insert(GoodsColorRemark goodsColorRemark) {
        return goodsColorRemarkMapper.insert(goodsColorRemark);
    }

    @Override
    public int delete(String goodsColorRemarkCode) {
        return goodsColorRemarkMapper.delete(goodsColorRemarkCode);
    }

    @Override
    public int update(GoodsColorRemark goodsColorRemark) {
        return goodsColorRemarkMapper.update(goodsColorRemark);
    }

    @Override
    public GoodsColorRemark getByGoodsColorRemarkCode(String goodsColorRemarkCode) {
        return goodsColorRemarkMapper.getByGoodsColorRemarkCode(goodsColorRemarkCode);
    }

    @Override
    public List<GoodsColorRemark> getList(String businessCode) {
        return goodsColorRemarkMapper.getList(businessCode);
    }

    @Override
    public PageInfo<GoodsColorRemark> getPageList(int pageIndex, int pageSize, String name,String businessCode) {
        PageHelper.startPage(pageIndex,pageSize);
        List<GoodsColorRemark> goodsColorRemarkList = goodsColorRemarkMapper.getPageList(name,businessCode);
        PageInfo<GoodsColorRemark> goodsColorRemarkPageInfo=new PageInfo<>(goodsColorRemarkList);
        return goodsColorRemarkPageInfo;
    }
}
